home *** CD-ROM | disk | FTP | other *** search
/ Aminet 5 / Aminet 5 - March 1995.iso / Aminet / dev / misc / LEDA_gene.lha / LEDA-3.1c-generic / incl / LEDA / point_set.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-08-05  |  1.7 KB  |  83 lines

  1. /*******************************************************************************
  2. +
  3. +  LEDA  3.1c
  4. +
  5. +
  6. +  point_set.h
  7. +
  8. +
  9. +  Copyright (c) 1994  by  Max-Planck-Institut fuer Informatik
  10. +  Im Stadtwald, 6600 Saarbruecken, FRG     
  11. +  All rights reserved.
  12. *******************************************************************************/
  13.  
  14.  
  15. #ifndef LEDA_POINT_SET_H
  16. #define LEDA_POINT_SET_H
  17.  
  18. #include <LEDA/point.h>
  19. #include <LEDA/impl/delaunay_tree.h>
  20.  
  21. typedef DT_item       ps_item;
  22.  
  23.  
  24. class Point_Set : public delaunay_tree {
  25.  
  26. void* ptr;  // d2_dictionary(double,double,DT_item)*
  27.  
  28. public:
  29.  
  30.  Point_Set();
  31. ~Point_Set();
  32.  
  33. ps_item       lookup(point);
  34.  
  35. list<ps_item> range_search(double, double, double, double);
  36.  
  37. list<point>  all_points();
  38.  
  39. ps_item      insert(point p, void* i);
  40.  
  41. ps_item      nearest_neighbor(point p){ return delaunay_tree::neighbor(p); }
  42.  
  43. void         change_inf(ps_item it, void* i) { delaunay_tree::change_inf(it,i);}
  44.  
  45. void         del(point);
  46.  
  47. void         del_item(ps_item it) { del(key(it)); }
  48.  
  49. list<ps_item> all_items();
  50. list<ps_item> convex_hull();
  51.  
  52. void          clear();
  53. int           size();
  54. bool          empty()   { return (size()==0) ? true:false; }
  55.  
  56. };
  57.  
  58.  
  59.  
  60.  
  61. template<class itype>
  62.  
  63. class _CLASSTYPE point_set : public Point_Set {
  64.  
  65. void clear_inf(GenPtr& x) { Clear(ACCESS(itype,x)); }
  66. void copy_inf(GenPtr& x)  { x=Copy(ACCESS(itype,x));  }
  67.  
  68. public:
  69.  
  70. void    change_inf(ps_item it, itype i) { Point_Set::change_inf(it,Convert(i));}
  71. itype   inf(ps_item it)          { return ACCESS(itype,Point_Set::inf(it)); }
  72. ps_item insert(point p, itype i) { return Point_Set::insert(p,Convert(i));}
  73.  
  74.  point_set()   {}
  75. ~point_set()   { clear(); }
  76. };
  77.  
  78. #define forall_ps_items(i,D) forall(i, (D.all_items()) )
  79.  
  80. #endif
  81.  
  82.